// mine/pages/animation/demo5/index.ts
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		boxHeight: 0,
		allNotices: ["还不必多说", "孟大妈排名都平等的", "难道是哪都撒", "dsajdjksajd", "孟大妈排名都平等的", "孟大妈排名都平等的", "还不必多说", "孟大妈排名都平等的", "难道是哪都撒大家别惦记拜见大圣", "dsajdjksajd", "孟大妈排名都平等的", "难道你三大块脑袋里看到拉萨离队抹上了房门时可免费"],
		notice: new Array<any>(),
		timer: null
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad() {
		let that = this
		var query = wx.createSelectorQuery();
		query.select('.crBox').boundingClientRect();
		query.exec(function (rect) {
			that.setData({
				boxHeight: rect[0].height * 2 - 200
			})
			console.log(that.data.boxHeight)
		});

		let num = 0
		let timer = setInterval(() => {
			let notice = this.data.notice
			if (num <= 3) {
				notice.push(this.data.allNotices[num])
			} else {
				notice.shift()
				notice.push(this.data.allNotices[num])
			}
			this.setData({
				notice
			})
			num++
		}, 10000)
		this.setData({
			timer
		})
	},

	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady() {

	},

	/**
	 * 生命周期函数--监听页面显示
	 */
	onShow() {

	},

	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide() {

	},

	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload() {
		if (this.data.timer) {
			clearInterval(this.data.timer)
		}
	},

	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh() {

	},

	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom() {

	},

	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage() {

	}
})